package com.enba.mallapi;

import com.enba.boot.generator.generator.AutoGeneratorHelper;
import javax.annotation.PostConstruct;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;

@ComponentScan(basePackages = {"com.enba.mallapi", "com.enba.mall.core"})
@MapperScan({"com.enba.mall.core.**.mapper","com.enba.mallapi.**.mapper"})
@EnableAsync
@SpringBootApplication
public class EnbaMallAppApplication {

  public static void main(String[] args) {
    ConfigurableApplicationContext run = SpringApplication.run(EnbaMallAppApplication.class, args);
  }

  @Autowired(required = false)
  private AutoGeneratorHelper autoGeneratorHelper;

  @PostConstruct
  public void generator() {
    // 代码自动生成
    if (autoGeneratorHelper != null) {
      autoGeneratorHelper.generator();
    }
  }
}
